<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery.blockUI.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/tableSel.js"/>"></script>
		<script type="text/javascript">
		function dosubmit(){
		    $('#listForm').submit();
		}
		
		function goAssignToCR(form){
			form = document.getElementById('listForm');
			var ids = getSelectionIds('a');
			if(ids.length<1){
				alert('Please select one at least.');
			}else{
				form.action=form.action.replace('list','assignToCr');
				$('#ids').val(ids);
				form.submit();
			}
		}
		function changedisplay(el){
			el.toggle("fast",function() {
				 //$Container.getContainerProxy().resize();
			});
		}
		$(document).ready(function(){
		    $('#selCreateStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCreateEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selLastTouchStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selLastTouchEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selSetApptStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selSetApptEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selShowStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selShowEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selPayStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selPayEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selAssignCrStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selAssignCrEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selInitVisitStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selInitVisitEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selOriginalClassTimeStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selOriginalClassTimeEndTime').datepicker( {dateFormat :'yy-mm-dd'});
            $("#selMarketingPlan").autocomplete("<s:url value="/marketing/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selMarketingPlan").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selMarketingPlanId").val(d.id);
            });
            $("#selAdChannel").autocomplete("<s:url value="/data/AdChannel/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selAdChannel").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selAdChannelId").val(d.id);
            });
            $("#selPTE").autocomplete("<s:url value="/data/PTE/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name+" "+d.wno;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name+" "+d.wno;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selPTE").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selPTEId").val(d.id);
            });
             $("#selCreateUser").autocomplete("<s:url value="/system/User/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selCreateUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCreateUserId").val(d.id);
            });
            $("#selCR").autocomplete("<s:url value="/system/User/autoCompleteCRAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
             $("#selCR").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCRId").val(d.id);
            });
            $("#selPTELead").autocomplete("<s:url value="/data/PTE/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name+" "+d.wno;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name+" "+d.wno;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selPTELead").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selPTELeadId").val(d.id);
            });
        });
		</script>
		<title><s:text name="system.title" /></title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="CRAssign/list" name="listForm" id="listForm"
						namespace="/customer">
						<input type="hidden" id="startIndex" name="startIndex" value="0" />
						<s:hidden name="ids" id="ids" />
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
								    Name :
									<s:textfield  id="selName"  size="4" name="name" />
									&nbsp;Status:
									<s:select id="selLeadsStatus" name="leadsStatus"
										listKey="name()" headerKey="" headerValue="--all--"
										list="@com.ef.constant.ELeadsStatus@values()" cssStyle="width:130px;"></s:select>
									&nbsp;Source:
									<s:select id="selLeadsSource" name="leadsSource"
										listKey="name()" headerKey="" headerValue="--all--"
										list="@com.ef.constant.ELeadsSource@values()" cssStyle="width:142px;"></s:select>
									&nbsp;Card:
									<s:textfield  id="eliteCard"  size="6" name="eliteCard" />
									&nbsp;NoCr:
									<s:checkbox name="noCr"></s:checkbox>
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										style="cursor: pointer" align="absmiddle"
										onclick="javascript:dosubmit();" />
									<img src="<s:url value="/img/right/btn-s2.gif"/>" border="0"
										style="cursor: pointer" align="absmiddle"
										onclick="javascript:changedisplay($('#div1'));" />
									<img src="<s:url value="/img/right/btn4.gif"/>" border="0"
										style="cursor: pointer" align="absmiddle"
										onclick="javascript:reset2();" />
									&nbsp;
									<img onclick="javascript:goAssignToCR();"
										src="<s:url value="/img/right/ast.gif"/>" border="0"
										align="absmiddle" />
									<s:select name="cr_id" list="crs"></s:select>
								</td>
							</tr>
						</table>
						<div id='div1' style="display: none;">
							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#E0F5FF">
								<tr>
									<td height="40">
									    &nbsp;Tel:
									    <s:textfield  id="selTelephone" size="15" name="telephone" />
										&nbsp;Type:
										<s:select id="selLeadsType" name="leadsType" listKey="name()"
											headerKey="" headerValue="--all--"
											list="@com.ef.constant.ELeadsType@values()"></s:select>
										&nbsp;Ad Channel:
										<s:textfield id="selAdChannel" name="adChannel.name"
											cssClass="input2" size="13" />
										<s:hidden id="selAdChannelId" name="adChannel.id" />
										
									</td>
								</tr>
								<tr>
									<td height="40">
									     &nbsp;MarketingPolicy:
										<s:select  id="selMarketingPolicy"  name="marketingPolicy.id" 
										    headerKey=""  headerValue="--all--"
											list="marketingPolicyList"></s:select>
									   &nbsp;PTE Lead:
										<s:textfield id="selPTELead"  name="pteLeader.name" cssClass="input2" size="13" />
										<s:hidden id="selPTELeadId" name="pteLeader.id"/>
									    &nbsp;PTE:
										<s:textfield id="selPTE"  name="pte.name" cssClass="input2" size="13" />
										<s:hidden id="selPTEId" name="pte.id"/>
										&nbsp;Init Visit Time:
										<s:textfield  id="selInitVisitStartTime" name="selInitVisitStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selInitVisitEndTime" name="selInitVisitEndTime" cssClass="input2" size="13" /> 
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;CreateUser:
										<s:textfield id="selCreateUser" name="createUser.name"
											cssClass="input2" size="10" />
										<s:hidden id="selCreateUserId" name="createUser.id" />
										&nbsp;CreateTime:
										<s:textfield id="selCreateStartTime" name="selCreateStartTime"
											cssClass="input2" size="10" />
										-
										<s:textfield id="selCreateEndTime" name="selCreateEndTime"
											cssClass="input2" size="10" />
										&nbsp;CR :
										<s:textfield id="selCC" name="cr.name" cssClass="input2"
											size="10" />
										<s:hidden id="selCCd" name="cr.id" />
										&nbsp;LastTouchTime:
										<s:textfield id="selLastTouchStartTime"
											name="selLastTouchStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selLastTouchEndTime"
											name="selLastTouchEndTime" cssClass="input2" size="10" />
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;SetApptTime:
										<s:textfield id="selSetApptStartTime"
											name="selSetApptStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selSetApptEndTime" name="selSetApptEndTime"
											cssClass="input2" size="10" />
										&nbsp;Show Time:
										<s:textfield id="selShowStartTime" name="selShowStartTime"
											cssClass="input2" size="10" />
										-
										<s:textfield id="selShowEndTime" name="selShowEndTime"
											cssClass="input2" size="10" />
										&nbsp;Pay Time:
										<s:textfield id="selPayStartTime" name="selPayStartTime"
											cssClass="input2" size="10" />
										-
										<s:textfield id="selPayEndTime" name="selPayEndTime"
											cssClass="input2" size="10" />
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;Finish Original Class Time:
										<s:textfield id="selOriginalClassTimeStartTime"
											name="selOriginalClassTimeStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selOriginalClassTimeEndTime" name="selOriginalClassTimeEndTime"
											cssClass="input2" size="10" />
									 	&nbsp;Assign Time:
										<s:textfield id="selAssignCrStartTime"
											name="selAssignCrStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selAssignCrEndTime" name="selAssignCrEndTime"
											cssClass="input2" size="10" />
									</td>
								</tr>
							</table>
						</div>
						<table width="100%" border="0" cellpadding="0" cellspacing="1"
							class="box2 activeTable">
							<tr>
								<td width="33" class="tablecolour1">
									<input type="checkbox" name="all" onclick="checkAll('a',this)" />
								</td>
								<td class="tablecolour1">
									Name
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									eliteCard
								</td>
								<td class="tablecolour1">
									Telephone
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Leads Source
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									TouchTime
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Last Comments
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									CR
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Assign Time
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Show Time
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Pay Time
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Status
								</td>
							</tr>
							<s:iterator value="listResult.items" status="status">
								<tr>
									<td class="tablecolour2">
										<input type="checkbox" name="a"
											value="<s:property value="id" />" />
									</td>
									<td class="tablecolour2">
										<s:property value="name" />
									</td>
									<td class="tablecolour2">
										<s:property value="eliteCard" />
									</td>
									<td class="tablecolour2">
										<s:property value="telephone" />
									</td>
									<td class="tablecolour2">
										<s:property value="leadsSource" />
									</td>
									<td class="tablecolour2">
										<s:property value="lastEventTime" />
									</td>
									<td class="tablecolour2">
										<s:property value="lastEventCommons" />
									</td>
									<td class="tablecolour2">
										<s:property value="cr.name" />
									</td>
									<td class="tablecolour2">
										<s:date name="crAssignTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:date name="showTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:date name="payTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:property value="leadsStatus" />
									</td>
								</tr>
							</s:iterator>
						</table>
						<s:include value="/common/page.jsp"></s:include>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>